#include "trackweldtastinstructionview.h"
#include "ui_trackweldtastinstructionview.h"

TrackWeldTASTInstructionView::TrackWeldTASTInstructionView(int styleId,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TrackWeldTASTInstructionView)
{
    ui->setupUi(this);
    setGeometry(5,50,451,544);
    initialDisplayStyle(styleId);
}

void TrackWeldTASTInstructionView::initialDisplayStyle(int styleId)
{
    switch (styleId) {
    case 1:
        ui->save_Btn->setGeometry(360,350,70,40);
        break;
    default:
        break;
    }
}

TrackWeldTASTInstructionView::~TrackWeldTASTInstructionView()
{
    delete ui;
}

void TrackWeldTASTInstructionView::getInput(TrackWeldTastInstruction &instructionParaOut)
{
    instructionParaOut.comment=ui->note_lineEdit->text();
    instructionParaOut.trackWeldPropertyIndex=ui->comboBox_conditionIndex->currentIndex();

}

void TrackWeldTASTInstructionView::updateView()
{

    ui->comboBox_conditionIndex->setCurrentIndex(instructionPara.trackWeldPropertyIndex);

    ui->note_lineEdit->setText(instructionPara.comment);

}

void TrackWeldTASTInstructionView::changeLanguage(int language)
{

}

void TrackWeldTASTInstructionView::finishEditInstruction(TrackWeldTastInstruction instructionParaIn, QString &instructionStrOut)
{
    instructionStrOut.clear();
       instructionStrOut="Track Weld TAST [";
       instructionStrOut+=QString::number(instructionParaIn.trackWeldPropertyIndex)+"]";
       instructionStrOut+=";//"+instructionParaIn.comment;
}

void TrackWeldTASTInstructionView::on_clearNote_Btn_clicked()
{
    ui->note_lineEdit->setText("");

}

void TrackWeldTASTInstructionView::on_save_Btn_clicked()
{
    getInput(instructionPara);
    finishEditInstruction(instructionPara,instructionStr);
//    emit finishEditInstructionSignal();

    emit saveInstructionSignal(instructionStr);
}

void TrackWeldTASTInstructionView::on_button_editCondition_clicked()
{

}
